package com.recsmile.sgs.client.commonds;

import java.util.List;

import com.kael.sgs.core.Command;
import com.kael.sgs.core.Connection;
import com.recsmile.sgs.client.ClientFrame;
import com.recsmile.sgs.client.entity.RoomInfo;
import com.recsmile.sgs.client.ui.components.LobbyGui;

public class DisplayLobbyUIClientCommand implements Command<ClientFrame> {
	private static final long serialVersionUID = 2969055754383503593L;
	private final List<RoomInfo> rooms;
	
	/**
	 * Create lobby's GUI with rooms
	 * @param rooms : rooms currently in the lobby
	 */
	public DisplayLobbyUIClientCommand(List<RoomInfo> rooms) {
		this.rooms = rooms;
	}
	
	@Override
	public void execute(ClientFrame ui, Connection connection) {
		ui.onNewPanelDisplayed(new LobbyGui(rooms, connection));
	}
}